package org.ldx.lotterysystem.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.ldx.lotterysystem.common.errorcode.ErrorCode;

@Data
@EqualsAndHashCode
public class ServiceException extends RuntimeException{
    /**
     * 错误码
     * @see org.ldx.lotterysystem.common.errorcode.ServiceErrorCodeConstants
     */
    private Integer code;
    private String message;

    public ServiceException(){

    }

    public ServiceException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ServiceException(ErrorCode code){
        this.code = code.getCode();
        this.message = code.getMsg();
    }
}
